using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_Pmts_no_ARMap : EntityTypeConfiguration<so_Pmts_no_AR>
    {
        public so_Pmts_no_ARMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Payment__, t.Date, t.cash_account, t.Amount, t.SUMFIELDS, t.Dimfields });

            // Properties
            this.Property(t => t.Payment__)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Created_By)
                .HasMaxLength(30);

            this.Property(t => t.document_Type)
                .HasMaxLength(7);

            this.Property(t => t.type)
                .HasMaxLength(11);

            this.Property(t => t.cash_account)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.batch)
                .HasMaxLength(10);

            this.Property(t => t.Cur)
                .HasMaxLength(5);

            this.Property(t => t.Origin)
                .HasMaxLength(10);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(15);

            this.Property(t => t.Dimfields)
                .IsRequired()
                .HasMaxLength(17);

            // Table & Column Mappings
            this.ToTable("so_Pmts_no_AR");
            this.Property(t => t.Payment__).HasColumnName("Payment_#");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Created_By).HasColumnName("Created_By");
            this.Property(t => t.document_Type).HasColumnName("document_Type");
            this.Property(t => t.type).HasColumnName("type");
            this.Property(t => t.cash_account).HasColumnName("cash_account");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.Cur).HasColumnName("Cur");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.closed).HasColumnName("closed");
            this.Property(t => t.Origin).HasColumnName("Origin");
            this.Property(t => t.Due_Date).HasColumnName("Due_Date");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.Dimfields).HasColumnName("Dimfields");
        }
    }
}
